/*
 * declaretest.c
 *
 *  Created on: 2013-5-4
 *      Author: xkaying
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../declare/declare_parser.h"
#include "../declare/declare_expression.h"

int main(void) {
	char *declare="{\n\t;这是注释	 \n		digit: '0'~ '9';\n	letter: 'a' | 'b';\n data: 0x30 - | 0x40+;\n send:data|letter;\n}";
	int len;
	len=strlen(declare);
	DeclareLex *plex;
	plex=DeclareLexer(declare,len);
	if(plex==0){
		printf("error!\n");
		return 0;
	}
	DeclareExpression *pde;
	pde=DeclareParser(plex);
	while(pde){
		DeclareExpressionPrint(pde);
		pde=DeclareParser(plex);
	}
	return EXIT_SUCCESS;
}
